#include<stdio.h>
#include<stdlib.h>
using namespace std;

int step=0;
void fun(int n){
    step++;
    if(n==1)
        return;
    if(n%2==0)
        n/=2;
    else
        n=n*3+1;
    fun(n);
}
void sort(int a[][10],int len){
    for(int i=0;i<len;i++){
        for(int k=0;k<len-1;k++)//比较n-1轮
            for(int j=0;j<len-1-k;j++){
                if(a[i][j]>a[i][j+1]){
                    int temp=a[i][j+1];
                    a[i][j+1]=a[i][j];
                    a[i][j]=temp;
                }
            }
    }
    for(int i=0;i<len;i++){
        for(int k=0;k<len-1;k++)//比较n-1轮
            for(int j=0;j<len-1-k;j++){
                if(a[j][i]>a[j+1][i]){
                    int temp=a[j+1][i];
                    a[j+1][i]=a[j][i];
                    a[j][i]=temp;
                }
            }
    }
    
}

int main(){
    // fun(22);
    // printf("%d",step);
    int a[10][10]={
        {9,2,3,4,6,5,8,7,1,0},
        {9,2,3,4,6,5,8,7,1,0},
        {1,2,3,4,6,5,8,7,9,0},
        {1,2,3,4,6,5,8,7,9,0},
        {10,20,30,40,60,50,80,70,90,100},
        {1,2,3,4,6,5,8,7,9,0},
        {1,2,3,4,6,5,8,7,9,0},
        {1,2,3,4,6,5,8,7,9,0},
        {1,2,3,4,6,5,8,7,9,0},
        {1,2,3,4,6,5,8,7,9,0}    
    };
    sort(a,10);
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }
    return 0;
}